package com.acsior.hibernate.vo;

// default package

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.acsior.dac.impl.hibernate.vo.GeneratorKey;
import com.acsior.dac.impl.hibernate.vo.HibernateVO;

/**
 * CdCRCode entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "cdCRCodes")
@GeneratorKey(tableName = "cdCRCodes")
public class CdCRCodeVO extends HibernateVO {
	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = -3512751183752577365L;

	@OneToMany(cascade = CascadeType.REFRESH, fetch = FetchType.LAZY, mappedBy = "cdCRCode")
	private List<CdAllowedPlaceVO> cdAllowedPlaces;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "bigClientID", nullable = false)
	private ContragentVO cdBigClient;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "codeTypeID", nullable = false)
	private CdCodeTypeVO cdCodeType;

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "cdCRCode")
	private List<CdReceiptBodyVO> cdReceiptBodies;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "taxGroupID", nullable = false)
	private CdTaxGroupVO cdTaxGroup;

	@Column(name = "code", nullable = false)
	private Integer code;

	@Id
	@Column(name = "crCodeID", unique = true, nullable = false)
	private Integer crCodeId;

	@Column(name = "isActive", nullable = false)
	private boolean isActive;

	@Column(name = "isGlobal", nullable = false)
	private boolean isGlobal;

	@Column(name = "name", nullable = false)
	private String name;

	@Column(name = "shortName", nullable = false)
	private String shortName;
	
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "cashService")
	private List<FiscalizationLinkVO> fiscalizations;


	// Constructors

	/** default constructor */
	public CdCRCodeVO() {
		this.cdAllowedPlaces = new ArrayList<CdAllowedPlaceVO>();
		this.cdReceiptBodies = new ArrayList<CdReceiptBodyVO>();
		this.fiscalizations = new ArrayList<FiscalizationLinkVO>();
	}

	
	/**
	 * @return стойността на cdAllowedPlaces
	 */
	public List<CdAllowedPlaceVO> getCdAllowedPlaces() {
		return this.cdAllowedPlaces;
	}

	
	/**
	 * @param cdAllowedPlaces се залага в cdAllowedPlaces
	 */
	public void setCdAllowedPlaces(List<CdAllowedPlaceVO> cdAllowedPlaces) {
		this.cdAllowedPlaces = cdAllowedPlaces;
	}

	
	/**
	 * @return стойността на cdBigClient
	 */
	public ContragentVO getCdBigClient() {
		return this.cdBigClient;
	}

	
	/**
	 * @param cdBigClient се залага в cdBigClient
	 */
	public void setCdBigClient(ContragentVO cdBigClient) {
		this.cdBigClient = cdBigClient;
	}

	
	/**
	 * @return стойността на cdCodeType
	 */
	public CdCodeTypeVO getCdCodeType() {
		return this.cdCodeType;
	}

	
	/**
	 * @param cdCodeType се залага в cdCodeType
	 */
	public void setCdCodeType(CdCodeTypeVO cdCodeType) {
		this.cdCodeType = cdCodeType;
	}

	
	/**
	 * @return стойността на cdReceiptBodies
	 */
	public List<CdReceiptBodyVO> getCdReceiptBodies() {
		return this.cdReceiptBodies;
	}

	
	/**
	 * @param cdReceiptBodies се залага в cdReceiptBodies
	 */
	public void setCdReceiptBodies(List<CdReceiptBodyVO> cdReceiptBodies) {
		this.cdReceiptBodies = cdReceiptBodies;
	}

	
	/**
	 * @return стойността на cdTaxGroup
	 */
	public CdTaxGroupVO getCdTaxGroup() {
		return this.cdTaxGroup;
	}

	
	/**
	 * @param cdTaxGroup се залага в cdTaxGroup
	 */
	public void setCdTaxGroup(CdTaxGroupVO cdTaxGroup) {
		this.cdTaxGroup = cdTaxGroup;
	}

	
	/**
	 * @return стойността на code
	 */
	public Integer getCode() {
		return this.code;
	}

	
	/**
	 * @param code се залага в code
	 */
	public void setCode(Integer code) {
		this.code = code;
	}

	
	/**
	 * @return стойността на crCodeId
	 */
	public Integer getCrCodeId() {
		return this.crCodeId;
	}

	
	/**
	 * @param crCodeId се залага в crCodeId
	 */
	public void setCrCodeId(Integer crCodeId) {
		this.crCodeId = crCodeId;
	}

	
	/**
	 * @return стойността на isActive
	 */
	public boolean isActive() {
		return this.isActive;
	}

	
	/**
	 * @param isActive се залага в isActive
	 */
	public void setActive(boolean isActive) {
		this.isActive = isActive;
	}

	
	/**
	 * @return стойността на isGlobal
	 */
	public boolean isGlobal() {
		return this.isGlobal;
	}

	
	/**
	 * @param isGlobal се залага в isGlobal
	 */
	public void setGlobal(boolean isGlobal) {
		this.isGlobal = isGlobal;
	}

	
	/**
	 * @return стойността на name
	 */
	public String getName() {
		return this.name;
	}

	
	/**
	 * @param name се залага в name
	 */
	public void setName(String name) {
		this.name = name;
	}

	
	/**
	 * @return стойността на shortName
	 */
	public String getShortName() {
		return this.shortName;
	}

	
	/**
	 * @param shortName се залага в shortName
	 */
	public void setShortName(String shortName) {
		this.shortName = shortName;
	}

	/**
	 * @see com.acsior.dac.data.Data#getId()
	 */
	@Override
	public Object getId() {
		return getCrCodeId();
	}

	/**
	 * @see com.acsior.dac.impl.hibernate.vo.HibernateVO#setId(java.lang.Object)
	 */
	@Override
	public void setId(Object id) {
		setCrCodeId(Integer.class.cast(id));
	}


	
	/**
	 * @return стойността на fiscalizations
	 */
	public List<FiscalizationLinkVO> getFiscalizations() {
		return this.fiscalizations;
	}


	
	/**
	 * @param fiscalizations се залага в fiscalizations
	 */
	public void setFiscalizations(List<FiscalizationLinkVO> fiscalizations) {
		this.fiscalizations = fiscalizations;
	}

}